class Set
{
    private int size;
    private String[] elements;
    
    public Set(int max_size)
    {
        elements = new String[max_size];
    }
    
    public Set()
    {
        elements = new String[100];
    }
    
    public boolean add(String el)
    {
        if (size >= elements.length || is_in_set(el))
        {
            return false;
        }
        
        elements[size] = el;
        size++;
        return true;
    }
    
    public boolean is_in_set(String el)
    {
        for (int i = 0; i < size; i++)
        {
            if (elements[i].equals(el))
            {
                return true;
            }
        }
        
        return false;
    }
    
    public String toString()
    {
        String s = "set: [";
        for (int i = 0; i < size; i++)
        {
            s += elements[i];
            if (i < size - 1)
            {
                s += ", ";
            }
        }
        s += "]";
        return s;
    }
    
    public void print()
    {
        System.out.println(toString());
    }
    
    public void clear()
    {
        size = 0;
    }
    
    public int size()
    {
        return size;
    }
    
    public boolean is_empty()
    {
        return size == 0;
    }
}

public class SetTest
{
    public static void main(String[] args)
    {
        Set s = new Set(5);
        
        System.out.println("test Set");
        System.out.println("========");

        System.out.println(String.format("is_empty(): %b", s.is_empty()));
        System.out.println(String.format("size(): %d", s.size()));
        System.out.println(String.format("add(\"string1\"): %b", s.add("string1")));
        System.out.println(String.format("is_empty(): %b", s.is_empty()));
        System.out.println(String.format("add(\"string2\"): %b", s.add("string2")));
        System.out.println(String.format("add(\"string5\"): %b", s.add("string5")));
        s.print();
        System.out.println(String.format("size(): %d", s.size()));
        System.out.println(String.format("add(\"string5): %b", s.add("string5")));
        System.out.println(String.format("add(\"string6\"): %b", s.add("string6")));
        System.out.println(String.format("size(): %d", s.size()));
        System.out.println(String.format("add(\"string7\"): %b", s.add("string7")));
        System.out.println(String.format("size(): %d", s.size()));
        System.out.println(String.format("add(\"string8\"): %b", s.add("string8")));
        System.out.println(String.format("size(): %d", s.size()));
        s.print();
        System.out.println(String.format("is_in_set(\"string5\"): %b", s.is_in_set("string5")));
        System.out.println(String.format("is_in_set(\"string8\"): %b", s.is_in_set("string8")));
        System.out.println("clear()");
        s.clear();
        s.print();
    }
}
